Imports System.Data.SqlClient
Imports Microsoft.ApplicationBlocks.Data.SqlHelper

Public Class Productos
    Public Function Obtener(ByVal idRubro As Integer)
        Dim DS As New DataSet
        DS = ExecuteDataset(My.Settings.MiCadena, CommandType.StoredProcedure, "MaterialesObtener", _
        New SqlParameter("@CodRub", idRubro))
        Return DS
    End Function

    Public Function GenerarMaterialYClasificacion(ByVal NomMat, ByVal NomCla)
        Dim DS As New DataSet
        DS = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(My.Settings.MiCadena, _
        CommandType.StoredProcedure, "MatYClaGenerar", New SqlParameter("@NomMat", NomMat), _
        New SqlParameter("@NomCla", NomCla))
        Return DS
    End Function

    Public Function GenerarProducto(ByVal CodCar, ByVal CodCla, ByVal CodIns, ByVal Obs)
        Dim DS As New DataSet
        DS = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(My.Settings.MiCadena, _
        CommandType.StoredProcedure, "ProductoGenerar", New SqlParameter("@CodCar", CodCar), _
        New SqlParameter("@CodCla", CodCla), New SqlParameter("@CodIns", CodIns), New SqlParameter("@Obs", Obs))
        Return DS
    End Function

    Public Function ObtenerProductos(Optional ByVal NomCla = "", Optional ByVal NomCar = "", _
    Optional ByVal NomIns = "")
        Dim DS As New DataSet
        DS = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(My.Settings.MiCadena, _
        CommandType.StoredProcedure, "ProductosObtener", New SqlParameter("@NomCla", NomCla), _
        New SqlParameter("@NomCar", NomCar), New SqlParameter("@NomIns", NomIns))
        Return DS
    End Function

    Public Function ObtenerMateriales(ByVal NomRub As String)
        Dim DS As New DataSet
        DS = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(My.Settings.MiCadena, _
        CommandType.StoredProcedure, "MaterialesObtener", New SqlParameter("@NomRub", NomRub))
        Return DS
    End Function

    Public Function ObtenerClasificaciones(ByVal CodMat As Long)
        Dim DS As New DataSet
        DS = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(My.Settings.MiCadena, _
        CommandType.StoredProcedure, "ClasificacionesFiltradasObtener", New SqlParameter("@CodMat", CodMat))
        Return DS
    End Function

    Public Function ObtenerClasificaciones() As DataSet
        Dim DS As New DataSet
        DS = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(My.Settings.MiCadena, "ClasificacionesFiltradasObtenerTodas")
        Return DS
    End Function
End Class
